import { GetterTree } from 'vuex'
import { Istate } from '../../interface'
export type Igetter = GetterTree<Istate, Istate>
const getters: Igetter = {
  getuser: state => state.user,
  getusers: ({ users }) => users ? users.rows : [],
  getactivity: ({ activity }) => activity ? activity.rows : [],
  getarticle: ({ article }) => article ? article.rows : [],
  getquestion: ({ question }) => question ? question.rows : [],
  getquestionbank: ({ questionbank }) => questionbank ? questionbank.rows : [],
  getlabel: ({ label }) => label ? label.rows : [],
  getuserscount: ({ users }) => Number(users?.count),
  getquestioncount: ({ question }) => Number(question?.count),
  getquestionbankcount: ({ questionbank }) => Number(questionbank?.count),
  getactivitycount: ({ activity }) => Number(activity?.count),
  getarticlecount: ({ article }) => Number(article?.count),
  getlabelcount: ({ label }) => Number(label?.count),
  getteam: ({ team }) => team ? team.rows : [],
  getteamcount: ({ team }) => Number(team?.count),
  getpackegekey: ({ packegekey }) => packegekey ? packegekey.rows : [],
  getspecialjudge: ({ specialjudge }) => specialjudge ? specialjudge.row : [],
  getspecialjudgecount: ({ specialjudge }) => specialjudge ? specialjudge.count : 0,
  // getOnlinUser: ({ onlineUser }) => onlineUser,
}
export default getters